<template>
	<view class="_user_item">
		<view class="u-flex u-flex-self-start u-p-l-32 u-p-r-32 ">
			<up-avatar :src="info.photo" size="120rpx"></up-avatar>
			<view class="u-m-l-24 u-flex-1">
				<view class="u-flex u-flex-between u-flex-items-center">
<!--					<view class="f-s-16 f-w-b">{{ info.name }} ({{ info.phonenumber }})</view>-->


<!--          <view v-if="loadStatus==0">{{ info.name }} {{info.phonenumberDesensitize}}</view>-->
          <view >{{ info.name }} {{info.phonenumber}}</view>
<!--          <view v-if="userInfo.newRoleName=='警务室处置人员'||userInfo.newRoleName=='警务室负责人'" style="    color: #1677FF;font-size: 28rpx;margin-left: 50rpx;" class="btnOpen"-->
<!--                @click = "openClick">{{loadStatus==0?'显示':'隐藏' }}</view>-->




					<status-tag :status="1"></status-tag>
				</view>
				<!-- <view class="u-tips-color f-s-14 u-m-t-16">慈溪市成品工程管理有限公司</view> -->
				<view class="u-tips-color f-s-14 u-m-t-16">
						微信昵称<text class="u-m-l-18">{{ info.nickName }}</text>
				</view>
				<view class="u-tips-color f-s-14 u-m-t-16">登陆IP<text class="u-m-l-18">{{ info.loginIp }}</text></view>
				<view class="u-tips-color f-s-14 u-m-t-16">最后登录<text class="u-m-l-18">{{ info.loginDate }}</text></view>
			</view>
		</view>
		<up-line  margin="24rpx 0 "></up-line>
		<view class="u-flex u-flex-end u-flex-items-center u-p-l-32 u-p-r-32">
			<!-- <view class="u-m-r-24">
				<up-button text="删除" :customStyle="{
					width: '120rpx',
					height: '56rpx',
					border: '1rpx solid #E5E5E5',
					background: '#fff',
					borderRadius: '8rpx',
					fontSize: '28rpx',
					color: 'color: rgba(0,0,0,0.65)'
				}"></up-button>
			</view>
			<view class="u-m-r-24">
				<up-button text="编辑" :customStyle="{
					width: '120rpx',
					height: '56rpx',
					border: '1rpx solid #E5E5E5',
					background: '#fff',
					borderRadius: '8rpx',
					fontSize: '28rpx',
					color: 'color: rgba(0,0,0,0.65)'
				}"></up-button>
			</view> -->
      <view class="u-m-r-12">
        <up-button text="删除人员" :customStyle="{
					width: '146rpx',
					height: '56rpx',
					border: '1rpx solid #E5E5E5',
					background: '#fa4b4b',
					borderRadius: '8rpx',
					fontSize: '28rpx',
					color: 'rgba(255,255,255,1)'
				}" @click="delate(info)"></up-button>
      </view>





      <view class="u-m-r-12">
        <up-button text="编辑人员" :customStyle="{
					width: '146rpx',
					height: '56rpx',
					border: '1rpx solid #E5E5E5',
					background: '#fff',
					borderRadius: '8rpx',
					fontSize: '28rpx',
					color: 'color: rgba(0,0,0,0.65)'
				}" @click="editor(info)"></up-button>
      </view>
			<view>
				<up-button text="详情" :customStyle="{
					width: '120rpx',
					height: '56rpx',
					background: '#1677FF',
					borderRadius: '8rpx',
					fontSize: '28rpx',
					color: '#FFFFFF'
				}" @click="toInfo" ></up-button>
			</view>
		</view>

	</view>
</template>

<script setup>
	import StatusTag from '@/components/common/StatusTag.vue';
  import {defineEmits, ref} from "vue";
  import storage from "../utils/storage";
  import {delCompanyInfo} from "../api/company";
  import {toast} from "uview-plus";
  import {showConfirm} from "../utils/common";
  import {delUser} from "../api/user";
	const props = defineProps({
		info: Object
	})

  const emit = defineEmits(['refresh']);
  // 删除企业

  const delate = (e)=>{


    showConfirm(`确定删除人员【${e.name}】吗？`).then(res => {
      if (!res.confirm) return;
      delUser(e.userId).then(res=>{
        toast("删除成功")
        emit('refresh', true)
      })
    })
  }



  const editor = (e)=>{

    uni.navigateTo({
      url: '/subPackages/company/user_post?isEditor=1&userInfo='+JSON.stringify(props.info)
    })

  }

  const userInfo = storage.get('user_info');
  // console.log('userInfo',userInfo);
  const loadStatus = ref(0)
  const openClick = ()=>{
    loadStatus.value===0?loadStatus.value=1:loadStatus.value=0

  }
	
	
	const toInfo = ()=>{
    console.log('toInfo',props.info)
		uni.navigateTo({
			url: `/subPackages/company/user_info?userInfo=${JSON.stringify(props.info) }&userId=${props.info.userId}&entID=${props.info.entID}`
		})
	}
	
</script>

<style lang="scss" scoped>
	._user_item {
		background: #FFFFFF;
		box-shadow: 0rpx 2rpx 20rpx 0rpx rgba(0, 0, 0, 0.05);
		border-radius: 16rpx;
		padding: 32rpx 0;
		margin-bottom: 24rpx;

		._title {
			min-width: 144rpx;
			width: 144rpx;
		}

	}
</style>